<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">

</head>
<style>

</style>
<body>
    <div class="layui-fluid main">
        <!--<fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">-->
                <!--<div class="layui-form-item" style="float: left;">-->
                    <!--<a href="{:url('admin/poi/addcountry')}" class="layui-btn layui-btn-sm a_menu">-->
                        <!--添加国家-->
                    <!--</a>-->
                <!--</div>-->

        <!--</fieldset>-->

        <table class="layui-table" lay-even="" lay-skin="line" >
            <colgroup>
                <col width="15%">
                <col width="15%">
                <col width="15%">
                <col width="20%">
                <col width="20%">
                <col width="15%">
            </colgroup>
            <thead>

            <tr >
                <th>ID</th>
                <th>名称</th>
                <th>国家/城市</th>
                <!--<th style="text-align: center;">是否推荐</th>-->
                <!--<th >热门城市设置</th>-->
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            {volist name="data" id="vo"}

            <tr>
                <td>{$vo.id}</td>
                <td><strong>{$vo.name}</strong></td>
                <td>
                    {if $vo.groupid==0}
                    国家
                    {else}
                    城市
                    {/if}
                </td>
                <!--<td></td>-->
                <!--<td></td>-->
                <td class="operation-menu">
                    <a href="####" class="layui-btn layui-btn-xs layui-btn-warm recovery" data-id="{$vo.id}" style="margin-right: 0;font-size:12px;">恢复</a>
                 <a class="layui-btn layui-btn-xs layui-btn-danger delete" data-id="{$vo.id}"  style="margin-right: 0;font-size:12px;">彻底删除</a>
                </td>
            </tr>
            {/volist}

            </tbody>
        </table>
            <div>{$data->render()}</div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>

        <script>
            layui.use('form', function () {
                var form = layui.form;





            });
        </script>
        <script type="text/javascript">

            $('.recovery').click(function(){
                var id = $(this).attr('data-id');
                var recovery='recovery';
                layer.confirm('确定要恢复数据吗?', function(index) {
                    $.ajax({
                        url:"{:url('admin/poi/recovery')}",
                        type:"post",
                        data:{id:id,bs:recovery},
                        success:function(res) {
                            layer.msg(res.msg);
                            if(res.code == 1) {
                                setTimeout(function(){
                                    location.href = res.url;
                                },1500)
                            }
                        }
                    })
                })
            })


            $('.delete').click(function(){
                var id = $(this).attr('data-id');
                var del='del';
                layer.confirm('确定要删除?', function(index) {
                    $.ajax({
                        url:"{:url('admin/poi/recovery')}",
                        type:"post",
                        data:{id:id,bs:del},
                        success:function(res) {
                            layer.msg(res.msg);
                            if(res.code == 1) {
                                setTimeout(function(){
                                    location.href = res.url;
                                },1500)
                            }
                        }
                    })
                })
            })
        </script>
        <script type="text/javascript">
            layui.use('layer', function(){
                var layer = layui.layer;










                $('.a_menu').click(function(){
                    var url = $(this).attr('href');
                    var a = 0;
                    $.ajax({
                        url:url
                        ,async:false
                        ,success:function(res){
                            if(res.code == 0) {
                                layer.msg(res.msg);
                                a = 1;
                            }
                        }
                    });
                    if(a === 0) {
                        layer.open({
                            type:2,
                            content:url,
                            area: ['800px', '750px'],
                            end:function(){
                                location.reload();
                            }
                        });
                    }
                    return false;
                });
            });
        </script>

</body>
</html>
